<template>
  <div>
    <div class="container">
      <div class="item-a">header</div>
      <div class="item-b">main</div>
      <div class="item-c">sidebar</div>
      <div class="item-d">footer</div>
    </div>
    <div class="imgBox">
      <img src="@/assets/images/003.png" alt="">
    </div>
    <div class="swiper-container" ref="slides">
      <div class="swiper-wrapper">
        <div class="swiper-slide">Slide 1111111111</div>
        <div class="swiper-slide">Slide 222222222</div>
        <div class="swiper-slide">Slide 3333333333</div>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>
      
      <!-- 如果需要导航按钮 -->
      <!-- <div class="swiper-button-prev"></div>
      <div class="swiper-button-next"></div> -->
      
      <!-- 如果需要滚动条 -->
      <!-- <div class="swiper-scrollbar"></div> -->
    </div>
  </div>
</template>

<script>
import Swiper from 'swiper'; //导入

export default {
  data () {
    return {
    }
  },
  mounted(){
    new Swiper (this.$refs.slides, {
      // loop: true,
      // 如果需要分页器
      pagination: '.swiper-pagination',
      autoplay: true
    //如果需要自动切换海报
      // autoplay: {
      //   delay: 3000,//时间 毫秒
      //   disableOnInteraction: false,//用户操作之后是否停止自动轮播
      // }
  })        
  }
}
</script>

<style>
.container {
  width: 100%;
  height: 300px;
  background:darkgray;
  display: grid;
  text-align: center;
  font-size: 20px;
  /* grid-template-columns: repeat(20%); */
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto;
  grid-template-areas: 
    "header header header header"
    "main main . sidebar"
    "footer footer footer footer";
}

.item-a {
  grid-area: header;
  background: chocolate;
}
.item-b {
  grid-area: main;
  background: cornsilk;
}
.item-c {
  grid-area: sidebar;
  background: darkcyan;
}
.item-d {
  grid-area: footer;
  background: darkkhaki;
}

.imgBox{
  width: 350px;
  height: 350px;
}
.imgBox img{
  min-width: 150px;
  min-height: 150px;
  max-height: 400px;
  max-width: 350px;
  /* width: 100%;
  height: 100%; */
}

.swiper-container{
  width: 100%;
  height: 3rem;
}
.swiper-wrapper{
  width: 100%;
  height: 100%;
}
.swiper-slide{
  width: 100%;
  height: 100%;
}
</style>